package com.example.llademo.manager;

import com.example.llademo.entity.LLAPosition;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author zhangqi
 * @date 2024/4/2
 * @time 17:47
 * @description
 */
@Component
@Slf4j
public class LlaManager {

    //转换lla列表到拼接格式化列表
    public List<String> convertObj2StrList(List<LLAPosition> llaPositionList){
        return llaPositionList.stream()
                .map(llaA0001 -> {
                    StringBuffer sb = new StringBuffer();
                    sb.append(llaA0001.getCaptureTime().toInstant().toString());
                    sb.append("  ");
                    sb.append(llaA0001.getLat());
                    sb.append("  ");
                    sb.append(llaA0001.getLon());
                    sb.append("  ");
                    sb.append(llaA0001.getAlt());
                    sb.append("  ");
                    sb.append(llaA0001.getLatRate());
                    sb.append("  ");
                    sb.append(llaA0001.getLonRate());
                    sb.append("  ");
                    sb.append(llaA0001.getAltRate());
                    return sb.toString();
                }).collect(Collectors.toList());
    }
}
